home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 272_01 / getkey.doc < prev    next >
Text File  |  1987-07-15  |  1KB  |  41 lines

  1.  
  2.  
  3.        NAME
  4.                getkey -- extended keyboard fetch
  5.  
  6.        SYNOPSIS
  7.                #include "keys.h"
  8.                r = getkey();
  9.                int r;          returns keyboard value
  10.  
  11.  
  12.        DESCRIPTION
  13.        This function eases the reading of all keys, whether normal
  14.        or function keys.  The getch() function is used to return a keyboard
  15.        value.  If the first value received is 0, then a second value
  16.        is fetched and 256 (0x100) is added to flag the return value
  17.        as an extended function key.  The calling program should check
  18.        for a return value greater than 255.  If true, subtract 256 (or
  19.        "and" with 0xff) and consider the result as a function key.
  20.        Most function keys are defined in keys.h, and others may be user added.
  21.  
  22.        EXAMPLE
  23.              This example tests for function key 3 (FK3)
  24.  
  25.              #include "keys.h"
  26.              int r;
  27.  
  28.              while(TRUE) {
  29.                 r = getkey();
  30.                 if(r < 256) {
  31.                    printf("Not FK3 key");
  32.                    continue;
  33.                    }
  34.                 else r &= 0xff;
  35.                 if(r == FK3) printf("FK3 sensed!!!");
  36.                 }
  37.  
  38.  
  39.  
  40.        This function is found in SMDLx.LIB for the Datalight Compiler.
  41.